//
//  CVSampleBasicViewController.h
//  CVSampleBasic
//
//  Created by  Artem on 12.08.11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#include <opencv2/core/mat.hpp>

@interface CVSampleBasicViewController : UIViewController <UIScrollViewDelegate, UIPickerViewDelegate, UIPickerViewDataSource, UITextFieldDelegate> {
    
    UIScrollView *scrollView;
    UIImageView *imageView;

    UIPickerView *pickerView;
    UITextField *textField;
    UISlider *slider;
    UISegmentedControl *blurSegmentedControl;
    UISegmentedControl *loadSegmentedControl;
    UIActivityIndicatorView *activityIndicator;
    UIBarButtonItem *loadImageButton;
    UIBarButtonItem *blurImageButton;
    UIBarButtonItem *saveImageButton;
    UIBarButtonItem *cancelButton;
    
@private
    cv::Mat  cv_image;
    
    NSArray *pickerViewArraySample;
    NSArray *pickerViewArraySaved;
    NSString *fileName;
}

@property (nonatomic, retain) IBOutlet UIScrollView *scrollView;
@property (nonatomic, retain) IBOutlet UIImageView *imageView;

@property (nonatomic, retain) IBOutlet UIPickerView *pickerView;

@property (nonatomic, retain) IBOutlet UITextField *textField;
@property (nonatomic, retain) IBOutlet UISlider *slider;
@property (nonatomic, retain) IBOutlet UISegmentedControl *blurSegmentedControl;
@property (nonatomic, retain) IBOutlet UISegmentedControl *loadSegmentedControl;
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activityIndicator;

@property (nonatomic, retain) IBOutlet UIBarButtonItem *loadImageButton;
@property (nonatomic, retain) IBOutlet UIBarButtonItem *blurImageButton;
@property (nonatomic, retain) IBOutlet UIBarButtonItem *saveImageButton;
@property (nonatomic, retain) IBOutlet UIBarButtonItem *cancelButton;

- (IBAction)loadImageSelected:(id)sender;
- (IBAction)loadImageDone:(id)sender;
- (IBAction)loadSourceChanged:(id)sender;


- (IBAction)blurImageSelected:(id)sender;
- (IBAction)blurImageDone:(id)sender;

- (IBAction)saveImageSelected:(id)sender;
- (IBAction)saveImageDone:(id)sender;

- (IBAction)cancelAction:(id)sender;
- (IBAction)ApplyBlurAction:(id)sender;

@property (nonatomic, retain) NSArray *pickerViewArraySample;
@property (nonatomic, retain) NSArray *pickerViewArraySaved;
@property (nonatomic, copy) NSString *fileName;

- (void) loadCVImageFromFile:(NSString *) theFileName;
- (void) saveCVImageToFile:(NSString *) theFileName;
- (int)  FilterSizeFromFloatValue:(float) theValue;
- (cv::Mat) blurImageWithFilterSized:(int) thefilterSize;


@end
